"""
Client端初级聊天
"""

import socket


def run_client():
    client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    client.connect(("127.0.0.1", 8090))

    while True:
        re_data = input()
        if re_data:
            client.send(re_data.encode("utf8"))

        # 获取从服务端发送的数据
        data = client.recv(1024)
        print(data.decode("utf8"))


if __name__ == '__main__':
    run_client()
